package thinkinjava4.util;

import java.lang.reflect.Array;

public class Generated {
    public static <T> T[] array(T[] a,Generator<T> gen){
        return new CollectionData<>(gen,a.length).toArray(a);
    }

    public static <T> T[] array(Class<T> type,Generator<T> gen,int size){
        T[] a=(T[]) Array.newInstance(type,size);
        return new CollectionData<>(gen,size).toArray(a);
    }
}
